﻿using MVAScratchPad.Common;
using System.Text;
using Windows.ApplicationModel.DataTransfer;

namespace MVAScratchPad.Models
{
    public class NoteModel : BaseModel
    {
        public NoteModel()
        {
            this.Key = System.Guid.NewGuid().ToString();
        }

        string _Key = default(string);
        public string Key { get { return _Key; } set { SetProperty(ref _Key, value); } }

        string _Title = default(string);
        public string Title { get { return _Title; } set { SetProperty(ref _Title, value); } }

        string _Notes = default(string);
        public string Notes { get { return _Notes; } set { SetProperty(ref _Notes, value); } }

        public string HtmlFormat()
        {
            var htmlBuilder = new StringBuilder();
            htmlBuilder.AppendFormat("<h1>{0}</h1>", Title);
            htmlBuilder.AppendFormat("<p>{0}</p>", Notes);
            return HtmlFormatHelper.CreateHtmlFormat(htmlBuilder.ToString());
        }

        public string TextFormat()
        {
            var textBuilder = new StringBuilder();
            textBuilder.AppendLine(Title);
            textBuilder.AppendLine();
            textBuilder.AppendLine(Notes);
            return textBuilder.ToString();
        }
    }
}